home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / cups.preinst < prev    next >
Text File  |  2008-10-20  |  2KB  |  87 lines

  1. #! /bin/sh
  2. # preinst script for cups
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <new-preinst> `install'
  10. #        * <new-preinst> `install' <old-version>
  11. #        * <new-preinst> `upgrade' <old-version>
  12. #        * <old-preinst> `abort-upgrade' <new-version>
  13.  
  14. mv_conffile() {
  15.   OLD="$1"
  16.   NEW="$2"
  17.   PKGNAME="cupsys"
  18.   if [ -e "$OLD" ]; then
  19.       md5sum=$(md5sum "$OLD" | sed -e 's/ .*//')
  20.       old_md5sum=$(dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e "\\' $OLD'{s/ obsolete$//;s/.* //p}")
  21.       if [ "$md5sum" = "$old_md5sum" ]; then
  22.           echo "Removing obsolete unchanged $OLD..." >&2
  23.           rm -f "$OLD"
  24.       else
  25.           echo "Moving customized $OLD to new location $NEW..." >&2
  26.           mv -f "$OLD" "$NEW"
  27.       fi
  28.   fi
  29. }
  30.  
  31. case "$1" in
  32.     install|upgrade)
  33.     if [ -e /var/lib/cups/ppd -a ! -L /var/lib/cups/ppd -a ! -e /etc/cups/ppd ]; then
  34.         echo -n "Moving printer definition files..."
  35.         mkdir -p /etc/cups/ppd || true
  36.         if [ `ls /var/lib/cups/ppd | wc -l` -ne "     0" ]; then
  37.         cp -a /var/lib/cups/ppd/* /etc/cups/ppd
  38.         fi
  39.         rm -rf /var/lib/cups/ppd
  40.         echo "done."
  41.     fi
  42.  
  43.     if [ -e /var/lib/cups/logs -a ! -L /var/lib/cups/logs ]; then
  44.         rmdir /var/lib/cups/logs || true
  45.     fi
  46.  
  47.     # Remove dangling pdftops.conf symlink, which is obsolete anyway
  48.     if [ -L /etc/cups/pdftops.conf -a ! -e /etc/cups/pdftops.conf ]; then
  49.         rm -f /etc/cups/pdftops.conf
  50.     fi
  51.  
  52.         # fix 'cupsys' -> 'root' file owner mode transition
  53.     if dpkg --compare-versions "$2" lt-nl '1.3.0-3'; then
  54.         if [ -d /var/run/cups ]; then
  55.         chown -R root /var/run/cups
  56.         fi
  57.             chown -R root /etc/cups /var/log/cups /var/cache/cups /var/spool/cups
  58.         fi
  59.  
  60.         # cupsys -> cups package/file rename
  61.     if dpkg --compare-versions "$2" le '1.3.7-7'; then
  62.             update-rc.d -f cupsys remove
  63.             mv_conffile /etc/default/cupsys /etc/default/cups
  64.             mv_conffile /etc/init.d/cupsys /etc/init.d/cups
  65.             mv_conffile /etc/pam.d/cupsys /etc/pam.d/cups
  66.             mv_conffile /etc/logrotate.d/cupsys /etc/logrotate.d/cups
  67.         fi
  68.     ;;
  69.  
  70.     abort-upgrade)
  71.     ;;
  72.  
  73.     *)
  74.         echo "preinst called with unknown argument \`$1'" >&2
  75.         exit 0
  76.     ;;
  77. esac
  78.  
  79. # dh_installdeb will replace this with shell code automatically
  80. # generated by other debhelper scripts.
  81.  
  82.  
  83.  
  84. exit 0
  85.  
  86.  
  87.